# coding: utf-8

import re

def palindrome(s):
    s = re.sub('[.,’;\s\']*', '', s).lower()

    if len(s) <= 1:
        return True

    if s[0] != s[-1]:
        return False

    return palindrome(s[1:-1])


test_str = [
    "kayak",
    "aibohphobia",
    "Live not on evil",
    "Reviled did I live, said I, as evil I did deliver",
    "Go hang a salami; I’m a lasagna hog.",
    "Able was I ere I saw Elba",
    "Kanakanak – a town in Alaska",
    "Wassamassaw – a town in South Dakota",
]


for s in test_str:
    print(palindrome(s))

print('--')

print(palindrome("x"))
print(palindrome("radar"))
print(palindrome("hello"))
print(palindrome(""))
print(palindrome("hannah"))
print(palindrome("madam i'm adam"))
